<template>
  <div class="update-gender">
    <van-picker
      title="性别"
      show-toolbar
      :columns="columns"
      :default-index="index"
      @cancel="$emit('close')"
      @confirm="onconfirm"
      @change="onChange"
    />
  </div>
</template>
<script>
export default {
  data() {
    return {
      columns: ['男', '女'],
      index: this.value
    }
  },
  props: ['value'],
  methods: {
    onChange(piker, value, index) {
      this.index = index
    },
    onconfirm() {
      this.$emit('confirm', this.index)
      this.$emit('close')
    }

  }
}
</script>
<style lang="less" scoped>
</style>